package com.kfy.databinding5;

import android.util.Log;

import androidx.databinding.ObservableField;

/**
 * @ProjectName: JetpackDemo
 * @Package: com.kfy.databinding4
 * @Author: K.F.Y
 * @Date: 2022/4/28
 */
public class UserViewModel {

    private ObservableField<User> userObservableField;

    public UserViewModel() {
        User user = new User("KeFuYou");
       userObservableField = new ObservableField<>();
       userObservableField.set(user);
    }

    public String getUserName() {
        return userObservableField.get().username;
    }

    public void setUserName(String userName) {
        Log.d("KFYTEST","set UserName :" + userName);
        userObservableField.get().username = userName;
    }

}
